package ${package}.${controller};

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Set;
import ${package}.common.Result;
import ${package}.${entity}.${simpleName};
import ${package}.${service}.${simpleName}Service;

@Slf4j
@RestController
@RequestMapping("/platform/${paramName}")
public class ${simpleName}Controller {

    @Autowired
    private ${simpleName}Service ${paramName}Service;

    @GetMapping(value = "list")
    public Result<IPage<${simpleName}>> list(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return ${paramName}Service.listPage(pageNo, pageSize);
    }

    @GetMapping(value = "/{id}")
    public Result<${simpleName}> detail(@PathVariable Integer id) {
        return ${paramName}Service.getById(id);
    }

    @PostMapping
    public Result add(@RequestBody ${simpleName} ${paramName}) {
        return ${paramName}Service.add(${paramName});
    }

    @PutMapping
    public Result update(@RequestBody ${simpleName} ${paramName}) {
        return ${paramName}Service.updateById(${paramName});
    }

    @DeleteMapping
    public Result delete(@RequestBody Set<Integer> ids) {
        return ${paramName}Service.deleteByIds(ids);
    }

}